package org.jeecg.modules.qyxx.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
import org.jeecg.modules.qyxx.entity.TycSswf;
import org.jeecg.modules.qyxx.entity.TycXzcf;
import org.jeecg.modules.qyxx.entity.req.BgNsrjbxxReq;
import org.jeecg.modules.qyxx.entity.req.SsjcSssjDTO;
import org.jeecg.modules.qyxx.mapper.TycSswfMapper;
import org.jeecg.modules.qyxx.service.ITycSswfService;
import org.jeecg.modules.qyxx.util.DateUtils;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.ArrayList;
import java.util.List;

/**
 * @Description: 税收违法
 * @Author: jeecg-boot
 * @Date:   2022-06-20
 * @Version: V1.0
 */
@Service
public class TycSswfServiceImpl extends MppServiceImpl<TycSswfMapper, TycSswf> implements ITycSswfService {

    @Override
    public List<TycSswf> sswf(SsjcSssjDTO req) {
       /* Page<TycSswf> page = new Page<>();
        page.setSize(req.getPageSize());
        page.setCurrent(req.getPageNo());*/
        return baseMapper.sswf(req.getShxydm(),req.getTjnd());
    }

    @Override
    public List<TycSswf> sswfBg(BgNsrjbxxReq req) {
        String djxh = req.getDjxh();
        List<String> tjnds = DateUtils.getInstance().nearlyThreeYears(req.getKssj(), req.getJssj());
        List<TycSswf> list = new ArrayList<>();
        for (String tjnd : tjnds) {
            List<TycSswf> tycSswfs = baseMapper.listByDjxhAndYear(djxh, tjnd);
            list.addAll(tycSswfs);
        }
        return list;
    }
}
